<!DOCTYPE html>
<html lang="zh-CN">

<head>
   <meta charset="UTF-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <title>vue事件处理</title>
   <script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
</head>

<body>
   <div id="root">
      <h2>欢迎新同学{{name}}</h2>
      <button @click='showinfo1'>click
         me不传参</button>
      <button @click='showinfo2(320054,event)'>click
         me传参</button>
   </div>
   <!-- 绑定事件默认传一个事件参数 -->
   <!-- 若手动传参，则需写"event"or"$event"来传事件对象 -->
   <script>
      Vue.config.productionTip = false
      const vm = new Vue({
         el: '#root',
         data: {
            name: 'chen',
            id: '3200541011'
         },
         methods: {
            showinfo1(a) {
               console.log(a);
            },
            showinfo2(number, shijian) {
               console.log(number, shijian);
            }
         }
      })
   </script>
</body>

</html>
